//
//  SSAddressCell.swift
//  拾舍清洁
//
//  Created by sky.wei on 2023/3/9.
//

import UIKit

class SSAddressCell: UITableViewCell {

    @IBOutlet weak var addressInfoLab: UILabel!
    
    @IBOutlet weak var contactInfo: UILabel!
    
    @IBOutlet weak var editeImg: UIButton!
    
    var address:SSAddress = SSAddress()
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        editeImg.isUserInteractionEnabled = true
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
    
    @IBAction func editeAction(_ sender: Any) {
        let sb = UIStoryboard(name: "SSAddressViewController", bundle: nil)
        let vc = sb.instantiateInitialViewController() as! SSAddressViewController
        vc.address = self.address
        vc.addressListController = UIViewController.current() as? SSAddressListController
        UIViewController.current().navigationController?.pushViewController(vc, animated: true)
    }
    
    func setData(address:SSAddress) {
        self.address = address
        addressInfoLab.text = "\(address.zip),\(address.address),\(address.houseNo)"
        contactInfo.text = "\(address.contact) \(address.contactPhone)"
    }
    
}
